{{include file='admin/include/inside_header.php'
<body>
<div class="container-fluid">
      <div class="row">
        <div class="col-md-12">
	        <div class="box">
	        	<div class="box-title row">
						<div class="col-md-10">
							<h3><i class="fa fa-list-alt fa-fw"></i>添加文章分类</h3>
						</div>
						<div class="col-md-2">
							<!-- 返回上一页及列表页 -->
							<a href="javascript:history.back(-1);" class="btn btn-default" ><span class="glyphicon glyphicon-chevron-left"></span>&nbsp; 返回上一页</a>
						</div>
				</div>
				<div class="box-content">
				<!--main/S-->
				 <div class="weichat_panel">
				   <div class="wchat_form">
					<form class="form-horizontal" id="add_form" method="post" role="form">
						#if($bean)
	        				<input type="hidden" id="id" name="id" value="$!bean.id"/>	
						#end
<div class="form-group">
                                    <label for="name" class="col-sm-2 control-label">name</label>
                                    <div class="col-sm-5">
                                     <input type="text" class="form-control" value="$!bean.name" name="name" id="name" placeholder="请输入name"> 
                                     </div>
                                  </div><div class="form-group">
                                    <label for="pid" class="col-sm-2 control-label">父分类</label>
                                    <div class="col-sm-5">
                                     <input type="text" class="form-control" value="$!bean.pid" name="pid" id="pid" placeholder="请输入父分类"> 
                                     </div>
                                  </div><div class="form-group">
                                    <label for="desc_text" class="col-sm-2 control-label">分类描述</label>
                                    <div class="col-sm-5">
                                     <input type="text" class="form-control" value="$!bean.desc_text" name="desc_text" id="desc_text" placeholder="请输入分类描述"> 
                                     </div>
                                  </div><!-- End SmartWizard Content -->  
				<div class="form-group">
                    <div class="col-sm-offset-2 col-sm-10">
                      <button id="submit_btn" type="submit" class="btn btn-default">提交</button>
                    </div>
                  </div>
				  
                </form>
               </div>
            </div>
			<!--main/E-->
		 </div>
		</div>
      </div>
</div>
<!-- Footer================================================== -->
{{include file='admin/include/footer.php'
 <script type="text/javascript">
     $(function(){
		//提交表单
       	  $('#add_form').validator({
        		theme: 'yellow_right_effect',  //设置theme
        		stopOnError: true, //
        		showOk:false,
        	    fields: {
        	        "name": {
        	            rule: "required;",
        	            ok: "",
        	            tip:"请填写名称",
        	            msg: {
        	            	required: "名称不可以为空!",
        	            }
        	        }
        	    }
        	});
		  $('#add_form').on('valid.form', function(e, form){
		  	   //成功之后刷新gd，关闭自己
			   var data=$(this).serialize();
				//提交表单
               $ .axsf('admin/category/add',data,function(d){
			   		if(d){
                         if(d.code==200){
							window.location.href="admin/category/index";
                         }else{
						 	alert(d.message);
						 }
                	}
			   });
        });
});
    </script>
    </body>
    </html>